﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace legends
{
    //
    // Class World
    //
    class World
    {

        private Tile[,] worldMap;
        private int worldWidth;
        private int worldHeight;
        private String name;
        private String info;
        private Position startPosition;
        public World(String name, int worldW, int worldH, Position pos)
        {
            worldMap = new Tile[worldW, worldH];
            for (int i = 0; i < worldW-1; i++) 
                for (int j=0; j<worldH-1;j++)
                {
                    this.worldMap[i, j] = new Tile(i, j, "water", TileType.Nature, "C:/water.bmp");
                }
            this.worldWidth = worldW;
            this.worldHeight = worldH;
            this.startPosition = pos;
            this.name = name;
            this.info = "blahblah, toto je ukazkovy svet";
        }
        //
        // Returns width of world map
        //
        public int GetWorldWidth()
        {
            return this.worldWidth;
        }

        //
        // Returns height of world map
        //
        public int GetWorldHeight()
        {
            return this.worldHeight;
        }
        // Returns path to TileImage
        public String GetTileImage(int x,int y)
        {
            return this.worldMap[x, y].getImage();
        }
        // Returns starting position
        public Position GetPosition()
        {
            return this.startPosition;
        }
    }
    //
    // Class Tile, representing one tile, EDIT: NOT USED YET
    //
    public enum TileType
    {
        Nature,
        Building,
        Event,
        Place,
        Unspecified
    }

    //
    // Class Tile, representing one tile
    //
    public class Tile
    {

        //
        // name of the tile
        //
        private String name;
        //
        // Represents position of tile on worldMap
        //
        private Position pos;
        //
        // Represents Type of tile such as nature, shop, event...
        //
        private TileType type;
        //
        // Name of image file, without path (for example "water.bmp")
        //
        private String image;

        //constructor
        public Tile(int x, int y, String name, TileType type, String icon)
        {
            this.pos = new Position(x, y);
            this.type = type;
            this.image = icon;
            this.name = name;
          
        }

        //constructor without specifiying position of tile on worldmap
        public Tile(String name, TileType type, String icon)
        {
            this.name = name;
            this.type = type;
            this.image = icon;

        }

        //method returns string representing path to image
        public String getImage()
        {
            return this.image;
        }

        public String getName()
        {
            return this.name;
        }

        public TileType getTileType()
        {
            return this.type;
        }
    }

    //
    // Class Position, representing position of tile on map 
    //
    public class Position
    {
        private int x;
        private int y;
        public Position(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        //method returns x position of tile on map
        public int getPosX()
        {
            return this.x;
        }
        //method returns y position of tile on map
        public int getPosY()
        {
            return this.y;
        }

    }
}
